const deepCopy = o => {
  if (typeof o !== 'object' || o === null) return o
  if (o.length === undefined) {
    let c = {}
    let keys = Object.keys(o)
    keys.forEach(k => {
      if (typeof o[k] === 'object') {
        c[k] = deepCopy(o[k])
      } else {
        c[k] = o[k]
      }
    })
    return c
  } else {
    return o.map(item => {
      return typeof item === 'object' ? deepCopy(item) : item
    })
  }
}

module.exports = {
  deepCopy,
}